package com.medium.house.enums;

/**
 * @author wang.yu
 */
public enum BasicStatusEnum {

    ENABLED(1, "启用"),
	DISABLE(2, "禁用"),
	DELETE(3, "删除"),
    ;

    private Integer code;
    private String desc;

    BasicStatusEnum(Integer code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static BasicStatusEnum toEnum(Integer code) {
        for (BasicStatusEnum item : BasicStatusEnum.values()) {
            if (item.code.equals(code)) {
                return item;
            }
        }
        StringBuilder str = new StringBuilder();
        str.append("the argument of ").append(code).append(" have no correspondence enum!");
        throw new IllegalArgumentException(str.toString());
    }


}
